<?php
require_once("include/bittorrent.php");
require('config/allconfig.php');
dbconn();
loggedinorreturn();
parked();
if ($ratioless == 'no') {
	stderr("错误", "当前RatioLess模式未开启");
}
$id = $CURUSER['id'];
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, categories.image, category, sp_state, size, snatched.uploaded, snatched.seedtime, snatched.leechtime, snatched.completedat FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND torrents.owner != $id AND userid=$id ORDER BY snatched.completedat DESC") or sqlerr();
$count = mysql_num_rows($res);
if (($CURUSER['uploaded'] >= $ACCOUNT['pudl'] * 1073741824) && ($count >= $ACCOUNT['puprratio']) && ($CURUSER['seedbonus'] >= $ACCOUNT['puderatio']) && (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['putime'] * 86400 * 7))) && ($CURUSER['hr'] <= 0) && $_POST['submit' . UC_USER]) {
	sql_query("UPDATE users SET seedbonus = seedbonus - " . $ACCOUNT['puderatio'] . ", class = " . UC_POWER_USER . " WHERE id = $id") or sqlerr();
	writeBonusComment($id, "升级到" . get_user_class_name_zh(UC_POWER_USER) . "消耗了" . $ACCOUNT['puderatio'] . "个魔力值");
	echo "<script>alert('升级成功');location.href = 'promotion.php';</script>"; //user->pu
} elseif (($CURUSER['uploaded'] >= $ACCOUNT['eudl'] * 1073741824) && ($count >= $ACCOUNT['euprratio']) && ($CURUSER['seedbonus'] >= $ACCOUNT['euderatio']) && (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['eutime'] * 86400 * 7))) && ($CURUSER['hr'] <= 0) && $_POST['submit' . UC_POWER_USER]) {
	sql_query("UPDATE users SET seedbonus = seedbonus - " . $ACCOUNT['euderatio'] . ", class = " . UC_ELITE_USER . " WHERE id = $id") or sqlerr();
	writeBonusComment($id, "升级到" . get_user_class_name_zh(UC_ELITE_USER) . "消耗了" . $ACCOUNT['euderatio'] . "个魔力值");
	echo "<script>alert('升级成功');location.href = 'promotion.php';</script>"; //pu->eu
} elseif (($CURUSER['uploaded'] >= $ACCOUNT['cudl'] * 1073741824) && ($count >= $ACCOUNT['cuprratio']) && ($CURUSER['seedbonus'] >= $ACCOUNT['cuderatio']) && (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['cutime'] * 86400 * 7))) && ($CURUSER['hr'] <= 0) && $_POST['submit' . UC_ELITE_USER]) {
	sql_query("UPDATE users SET seedbonus = seedbonus - " . $ACCOUNT['cuderatio'] . ", class = " . UC_CRAZY_USER . " WHERE id = $id") or sqlerr();
	writeBonusComment($id, "升级到" . get_user_class_name_zh(UC_CRAZY_USER) . "消耗了" . $ACCOUNT['cuderatio'] . "个魔力值");
	echo "<script>alert('升级成功');location.href = 'promotion.php';</script>"; //eu->cu
} elseif (($CURUSER['uploaded'] >= $ACCOUNT['iudl'] * 1073741824) && ($count >= $ACCOUNT['iuprratio']) && ($CURUSER['seedbonus'] >= $ACCOUNT['iuderatio']) && (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['iutime'] * 86400 * 7))) && ($CURUSER['hr'] <= 0) && ($CURUSER['hr'] <= 0) && $_POST['submit' . UC_CRAZY_USER]) {
	sql_query("UPDATE users SET seedbonus = seedbonus - " . $ACCOUNT['iuderatio'] . ", class = " . UC_INSANE_USER . " WHERE id = $id") or sqlerr();
	writeBonusComment($id, "升级到" . get_user_class_name_zh(UC_INSANE_USER) . "消耗了" . $ACCOUNT['iuderatio'] . "个魔力值");
	echo "<script>alert('升级成功');location.href = 'promotion.php';</script>"; //cu->iu
} elseif (($CURUSER['uploaded'] >= $ACCOUNT['vudl'] * 1073741824) && ($count >= $ACCOUNT['vuprratio']) && ($CURUSER['seedbonus'] >= $ACCOUNT['vuderatio']) && (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['vutime'] * 86400 * 7))) && ($CURUSER['hr'] <= 0) && $_POST['submit' . UC_INSANE_USER]) {
	sql_query("UPDATE users SET seedbonus = seedbonus - " . $ACCOUNT['vuderatio'] . ", class = " . UC_VETERAN_USER . " WHERE id = $id") or sqlerr();
	writeBonusComment($id, "升级到" . get_user_class_name_zh(UC_VETERAN_USER) . "消耗了" . $ACCOUNT['vuderatio'] . "个魔力值");
	echo "<script>alert('升级成功');location.href = 'promotion.php';</script>"; //iu->vu
} elseif (($CURUSER['uploaded'] >= $ACCOUNT['exudl'] * 1073741824) && ($count >= $ACCOUNT['exuprratio']) && ($CURUSER['seedbonus'] >= $ACCOUNT['exuderatio']) && (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['exutime'] * 86400 * 7))) && ($CURUSER['hr'] <= 0) && $_POST['submit' . UC_VETERAN_USER]) {
	sql_query("UPDATE users SET seedbonus = seedbonus - " . $ACCOUNT['exuderatio'] . ", class = " . UC_EXTREME_USER . " WHERE id = $id") or sqlerr();
	writeBonusComment($id, "升级到" . get_user_class_name_zh(UC_EXTREME_USER) . "消耗了" . $ACCOUNT['exuderatio'] . "个魔力值");
	echo "<script>alert('升级成功');location.href = 'promotion.php';</script>"; //vu->exu
} elseif (($CURUSER['uploaded'] >= $ACCOUNT['uudl'] * 1073741824) && ($count >= $ACCOUNT['uuprratio']) && ($CURUSER['seedbonus'] >= $ACCOUNT['uuderatio']) && (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['uutime'] * 86400 * 7))) && ($CURUSER['hr'] <= 0) && $_POST['submit' . UC_EXTREME_USER]) {
	sql_query("UPDATE users SET seedbonus = seedbonus - " . $ACCOUNT['uuderatio'] . ", class = " . UC_ULTIMATE_USER . " WHERE id = $id") or sqlerr();
	writeBonusComment($id, "升级到" . get_user_class_name_zh(UC_ULTIMATE_USER) . "消耗了" . $ACCOUNT['uuderatio'] . "个魔力值");
	echo "<script>alert('升级成功');location.href = 'promotion.php';</script>"; //exu->uu
} elseif (($CURUSER['uploaded'] >= $ACCOUNT['nmdl'] * 1073741824) && ($count >= $ACCOUNT['nmprratio']) && ($CURUSER['seedbonus'] >= $ACCOUNT['nmderatio']) && (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['nmtime'] * 86400 * 7))) && ($CURUSER['hr'] <= 0) && $_POST['submit' . UC_ULTIMATE_USER]) {
	sql_query("UPDATE users SET seedbonus = seedbonus - " . $ACCOUNT['nmderatio'] . ", class = " . UC_NEXUS_MASTER . " WHERE id = $id") or sqlerr();
	writeBonusComment($id, "升级到" . get_user_class_name_zh(UC_NEXUS_MASTER) . "消耗了" . $ACCOUNT['nmderatio'] . "个魔力值");
	echo "<script>alert('升级成功');location.href = 'promotion.php';</script>"; //uu->nm
}
stdhead();
?>
<div>
	<table style='width: 85%'>
		<tr class=rowfollow><td class='colhead' align='center'><?= get_user_class_name_zh(UC_POWER_USER) ?></td><td class='colhead' align='center'><?= get_user_class_name_zh(UC_ELITE_USER) ?></td><td class='colhead' align='center'><?= get_user_class_name_zh(UC_CRAZY_USER) ?></td><td class='colhead' align='center'><?= get_user_class_name_zh(UC_INSANE_USER) ?></td><td class='colhead' align='center'><?= get_user_class_name_zh(UC_VETERAN_USER) ?></td><td class='colhead' align='center'><?= get_user_class_name_zh(UC_EXTREME_USER) ?></td><td class='colhead' align='center'><?= get_user_class_name_zh(UC_ULTIMATE_USER) ?></td><td class='colhead' align='center'><?= get_user_class_name_zh(UC_NEXUS_MASTER) ?></td></tr>
		<tr class=torrent_table><td>&nbsp;&nbsp;注册需 <?= $ACCOUNT['putime'] * 7 ?> 天<br />&nbsp;&nbsp;上传量大于 <?= mksize($ACCOUNT['pudl'] * 1073741824) ?><br />&nbsp;&nbsp;完成数大于 <?= $ACCOUNT['puprratio'] ?><br />&nbsp;&nbsp;魔力值需 <?= number_format($ACCOUNT['puderatio']) ?><br />&nbsp;&nbsp;<b style="color: #D93C37">等级福利：积分加成 1.15</b></td><td>&nbsp;&nbsp;注册需 <?= $ACCOUNT['eutime'] * 7 ?> 天<br />&nbsp;&nbsp;上传量大于 <?= mksize($ACCOUNT['eudl'] * 1073741824) ?><br />&nbsp;&nbsp;完成数大于 <?= $ACCOUNT['euprratio'] ?><br />&nbsp;&nbsp;魔力值需 <?= number_format($ACCOUNT['euderatio']) ?><br />&nbsp;&nbsp;<b style="color: #D93C37">等级福利：积分加成 1.2</b></td><td>&nbsp;&nbsp;注册需 <?= $ACCOUNT['cutime'] * 7 ?> 天<br />&nbsp;&nbsp;上传量大于 <?= mksize($ACCOUNT['cudl'] * 1073741824) ?><br />&nbsp;&nbsp;完成数大于 <?= $ACCOUNT['cuprratio'] ?><br />&nbsp;&nbsp;魔力值需 <?= number_format($ACCOUNT['cuderatio']) ?><br />&nbsp;&nbsp;<b style="color: #D93C37">等级福利：积分加成 1.25</b></td><td>&nbsp;&nbsp;注册需 <?= $ACCOUNT['iutime'] * 7 ?> 天<br />&nbsp;&nbsp;上传量大于 <?= mksize($ACCOUNT['iudl'] * 1073741824) ?><br />&nbsp;&nbsp;完成数大于 <?= $ACCOUNT['iuprratio'] ?><br />&nbsp;&nbsp;魔力值需 <?= number_format($ACCOUNT['iuderatio']) ?><br />&nbsp;&nbsp;<b style="color: #D93C37">等级福利：积分加成 1.3</b></td><td>&nbsp;&nbsp;注册需 <?= $ACCOUNT['vutime'] * 7 ?> 天<br />&nbsp;&nbsp;上传量大于 <?= mksize($ACCOUNT['vudl'] * 1073741824) ?><br />&nbsp;&nbsp;完成数大于 <?= $ACCOUNT['vuprratio'] ?><br />&nbsp;&nbsp;魔力值需 <?= number_format($ACCOUNT['vuderatio']) ?><br />&nbsp;&nbsp;<b style="color: #D93C37">等级福利：积分加成 1.35</b></td><td>&nbsp;&nbsp;注册需 <?= $ACCOUNT['exutime'] * 7 ?> 天<br />&nbsp;&nbsp;上传量大于 <?= mksize($ACCOUNT['exudl'] * 1073741824) ?><br />&nbsp;&nbsp;完成数大于 <?= $ACCOUNT['exuprratio'] ?><br />&nbsp;&nbsp;魔力值需 <?= number_format($ACCOUNT['exuderatio']) ?><br />&nbsp;&nbsp;<b style="color: #D93C37">等级福利：积分加成 1.4</b></td><td>&nbsp;&nbsp;注册需 <?= $ACCOUNT['uutime'] * 7 ?> 天<br />&nbsp;&nbsp;上传量大于 <?= mksize($ACCOUNT['uudl'] * 1073741824) ?><br />&nbsp;&nbsp;完成数大于 <?= $ACCOUNT['uuprratio'] ?><br />&nbsp;&nbsp;魔力值需 <?= number_format($ACCOUNT['uuderatio']) ?><br />&nbsp;&nbsp;<b style="color: #D93C37">等级福利：积分加成 1.45</b></td><td>&nbsp;&nbsp;注册需 <?= $ACCOUNT['nmtime'] * 7 ?> 天<br />&nbsp;&nbsp;上传量大于 <?= mksize($ACCOUNT['nmdl'] * 1073741824) ?><br />&nbsp;&nbsp;完成数大于 <?= $ACCOUNT['nmprratio'] ?><br />&nbsp;&nbsp;魔力值需 <?= number_format($ACCOUNT['nmderatio']) ?><br />&nbsp;&nbsp;<b style="color: #D93C37">等级福利：积分加成 1.5</b></td></tr>
	</table>
</div><br />
<?php
if (get_user_class() == UC_USER) {
	print("<div>");
	print("<h1>升级到" . get_user_class_name_zh(UC_POWER_USER) . "</h1>");
	print("<table style='width: 95%'>");
	print("<tr class=rowfollow><td class='colhead' align='left'>项目</td><td class='colhead' align='left'>需求</td><td class='colhead' align='left'>条件</td><td class='colhead' align='left'>达成</td></tr>");
	print("<tr class=torrent_table><td>上传量</td><td>需要 " . mksize($ACCOUNT['pudl'] * 1073741824) . "</td><td>你有 " . mksize($CURUSER['uploaded']) . "</td><td>" . ($CURUSER['uploaded'] >= $ACCOUNT['pudl'] * 1073741824 ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>完成数</td><td>需要完成下载 " . $ACCOUNT['puprratio'] . " 个</td><td>你完成了 $count 个下载</td><td>" . ($count >= $ACCOUNT['puprratio'] ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>魔力值</td><td>需要 " . number_format($ACCOUNT['puderatio']) . " 个魔力值</td><td>你有 " . number_format($CURUSER['seedbonus']) . " 个魔力值</td><td>" . ($CURUSER['seedbonus'] >= $ACCOUNT['puderatio'] ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>加入时间</td><td>需要注册满 " . $ACCOUNT['putime'] * 7 . " 天</td><td>你已经注册满 " . round((strtotime(date("Y-m-d H:i:s", time())) - strtotime($CURUSER['added'])) / 86400) . " 天</td><td>" . (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['putime'] * 86400 * 7)) ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>H&R</td><td>需要 0 个H&R</td><td>你有 " . $CURUSER['hr'] . " 个H&R</td><td>" . ($CURUSER['hr'] <= 0 ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("</table><br />");
	print("<form method='POST'>");
	print((($CURUSER['uploaded'] >= $ACCOUNT['pudl'] * 1073741824) && ($count >= $ACCOUNT['puprratio']) && ($CURUSER['seedbonus'] >= $ACCOUNT['puderatio']) && (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['putime'] * 86400 * 7))) && ($CURUSER['hr'] <= 0)) ? "<input type='submit' name='submit" . UC_USER . "' value='购买' />" : "<input type='submit' name='submit" . UC_USER . "' value='购买' disabled/>");
	print("</form>");
	print("</div>");
} elseif (get_user_class() == UC_POWER_USER) {
	print("<div>");
	print("<h1>升级到" . get_user_class_name_zh(UC_ELITE_USER) . "</h1>");
	print("<table style='width: 95%'>");
	print("<tr class=rowfollow><td class='colhead' align='left'>项目</td><td class='colhead' align='left'>需求</td><td class='colhead' align='left'>条件</td><td class='colhead' align='left'>达成</td></tr>");
	print("<tr class=torrent_table><td>上传量</td><td>需要 " . mksize($ACCOUNT['eudl'] * 1073741824) . "</td><td>你有 " . mksize($CURUSER['uploaded']) . "</td><td>" . ($CURUSER['uploaded'] >= $ACCOUNT['eudl'] * 1073741824 ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>完成数</td><td>需要完成下载 " . $ACCOUNT['euprratio'] . " 个</td><td>你完成了 $count 个下载</td><td>" . ($count >= $ACCOUNT['euprratio'] ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>魔力值</td><td>需要 " . number_format($ACCOUNT['euderatio']) . " 个魔力值</td><td>你有 " . number_format($CURUSER['seedbonus']) . " 个魔力值</td><td>" . ($CURUSER['seedbonus'] >= $ACCOUNT['euderatio'] ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>加入时间</td><td>需要注册满 " . $ACCOUNT['eutime'] * 7 . " 天</td><td>你已经注册满 " . round((strtotime(date("Y-m-d H:i:s", time())) - strtotime($CURUSER['added'])) / 86400) . " 天</td><td>" . (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['eutime'] * 86400 * 7)) ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>H&R</td><td>需要 0 个H&R</td><td>你有 " . $CURUSER['hr'] . " 个H&R</td><td>" . ($CURUSER['hr'] <= 0 ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("</table><br />");
	print("<form method='POST'>");
	print((($CURUSER['uploaded'] >= $ACCOUNT['eudl'] * 1073741824) && ($count >= $ACCOUNT['euprratio']) && ($CURUSER['seedbonus'] >= $ACCOUNT['euderatio']) && (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['eutime'] * 86400 * 7))) && ($CURUSER['hr'] <= 0)) ? "<input type='submit' name='submit" . UC_POWER_USER . "' value='购买' />" : "<input type='submit' name='submit" . UC_POWER_USER . "' value='购买' disabled/>");
	print("</form>");
	print("</div>");
} elseif (get_user_class() == UC_ELITE_USER) {
	print("<div>");
	print("<h1>升级到" . get_user_class_name_zh(UC_CRAZY_USER) . "</h1>");
	print("<table style='width: 95%'>");
	print("<tr class=rowfollow><td class='colhead' align='left'>项目</td><td class='colhead' align='left'>需求</td><td class='colhead' align='left'>条件</td><td class='colhead' align='left'>达成</td></tr>");
	print("<tr class=torrent_table><td>上传量</td><td>需要 " . mksize($ACCOUNT['cudl'] * 1073741824) . "</td><td>你有 " . mksize($CURUSER['uploaded']) . "</td><td>" . ($CURUSER['uploaded'] >= $ACCOUNT['cudl'] * 1073741824 ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>完成数</td><td>需要完成下载 " . $ACCOUNT['cuprratio'] . " 个</td><td>你完成了 $count 个下载</td><td>" . ($count >= $ACCOUNT['cuprratio'] ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>魔力值</td><td>需要 " . number_format($ACCOUNT['cuderatio']) . " 个魔力值</td><td>你有 " . number_format($CURUSER['seedbonus']) . " 个魔力值</td><td>" . ($CURUSER['seedbonus'] >= $ACCOUNT['cuderatio'] ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>加入时间</td><td>需要注册满 " . $ACCOUNT['cutime'] * 7 . " 天</td><td>你已经注册满 " . round((strtotime(date("Y-m-d H:i:s", time())) - strtotime($CURUSER['added'])) / 86400) . " 天</td><td>" . (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['cutime'] * 86400 * 7)) ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>H&R</td><td>需要 0 个H&R</td><td>你有 " . $CURUSER['hr'] . " 个H&R</td><td>" . ($CURUSER['hr'] <= 0 ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("</table><br />");
	print("<form method='POST'>");
	print((($CURUSER['uploaded'] >= $ACCOUNT['cudl'] * 1073741824) && ($count >= $ACCOUNT['cuprratio']) && ($CURUSER['seedbonus'] >= $ACCOUNT['cuderatio']) && (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['cutime'] * 86400 * 7))) && ($CURUSER['hr'] <= 0)) ? "<input type='submit' name='submit" . UC_ELITE_USER . "' value='购买' />" : "<input type='submit' name='submit" . UC_ELITE_USER . "' value='购买' disabled/>");
	print("</form>");
	print("</div>");
} elseif (get_user_class() == UC_CRAZY_USER) {
	print("<div>");
	print("<h1>升级到" . get_user_class_name_zh(UC_INSANE_USER) . "</h1>");
	print("<table style='width: 95%'>");
	print("<tr class=rowfollow><td class='colhead' align='left'>项目</td><td class='colhead' align='left'>需求</td><td class='colhead' align='left'>条件</td><td class='colhead' align='left'>达成</td></tr>");
	print("<tr class=torrent_table><td>上传量</td><td>需要 " . mksize($ACCOUNT['iudl'] * 1073741824) . "</td><td>你有 " . mksize($CURUSER['uploaded']) . "</td><td>" . ($CURUSER['uploaded'] >= $ACCOUNT['iudl'] * 1073741824 ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>完成数</td><td>需要完成下载 " . $ACCOUNT['iuprratio'] . " 个</td><td>你完成了 $count 个下载</td><td>" . ($count >= $ACCOUNT['iuprratio'] ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>魔力值</td><td>需要 " . number_format($ACCOUNT['iuderatio']) . " 个魔力值</td><td>你有 " . number_format($CURUSER['seedbonus']) . " 个魔力值</td><td>" . ($CURUSER['seedbonus'] >= $ACCOUNT['iuderatio'] ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>加入时间</td><td>需要注册满 " . $ACCOUNT['iutime'] * 7 . " 天</td><td>你已经注册满 " . round((strtotime(date("Y-m-d H:i:s", time())) - strtotime($CURUSER['added'])) / 86400) . " 天</td><td>" . (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['iutime'] * 86400 * 7)) ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>H&R</td><td>需要 0 个H&R</td><td>你有 " . $CURUSER['hr'] . " 个H&R</td><td>" . ($CURUSER['hr'] <= 0 ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("</table><br />");
	print("<form method='POST'>");
	print((($CURUSER['uploaded'] >= $ACCOUNT['iudl'] * 1073741824) && ($count >= $ACCOUNT['iuprratio']) && ($CURUSER['seedbonus'] >= $ACCOUNT['iuderatio']) && (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['iutime'] * 86400 * 7))) && ($CURUSER['hr'] <= 0)) ? "<input type='submit' name='submit" . UC_CRAZY_USER . "' value='购买' />" : "<input type='submit' name='submit" . UC_CRAZY_USER . "' value='购买' disabled/>");
	print("</form>");
	print("</div>");
} elseif (get_user_class() == UC_INSANE_USER) {
	print("<div>");
	print("<h1>升级到" . get_user_class_name_zh(UC_VETERAN_USER) . "</h1>");
	print("<table style='width: 95%'>");
	print("<tr class=rowfollow><td class='colhead' align='left'>项目</td><td class='colhead' align='left'>需求</td><td class='colhead' align='left'>条件</td><td class='colhead' align='left'>达成</td></tr>");
	print("<tr class=torrent_table><td>上传量</td><td>需要 " . mksize($ACCOUNT['vudl'] * 1073741824) . "</td><td>你有 " . mksize($CURUSER['uploaded']) . "</td><td>" . ($CURUSER['uploaded'] >= $ACCOUNT['vudl'] * 1073741824 ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>完成数</td><td>需要完成下载 " . $ACCOUNT['vuprratio'] . " 个</td><td>你完成了 $count 个下载</td><td>" . ($count >= $ACCOUNT['vuprratio'] ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>魔力值</td><td>需要 " . number_format($ACCOUNT['vuderatio']) . " 个魔力值</td><td>你有 " . number_format($CURUSER['seedbonus']) . " 个魔力值</td><td>" . ($CURUSER['seedbonus'] >= $ACCOUNT['vuderatio'] ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>加入时间</td><td>需要注册满 " . $ACCOUNT['vutime'] * 7 . " 天</td><td>你已经注册满 " . round((strtotime(date("Y-m-d H:i:s", time())) - strtotime($CURUSER['added'])) / 86400) . " 天</td><td>" . (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['vutime'] * 86400 * 7)) ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>H&R</td><td>需要 0 个H&R</td><td>你有 " . $CURUSER['hr'] . " 个H&R</td><td>" . ($CURUSER['hr'] <= 0 ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("</table><br />");
	print("<form method='POST'>");
	print((($CURUSER['uploaded'] >= $ACCOUNT['vudl'] * 1073741824) && ($count >= $ACCOUNT['vuprratio']) && ($CURUSER['seedbonus'] >= $ACCOUNT['vuderatio']) && (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['vutime'] * 86400 * 7))) && ($CURUSER['hr'] <= 0)) ? "<input type='submit' name='submit" . UC_INSANE_USER . "' value='购买' />" : "<input type='submit' name='submit" . UC_INSANE_USER . "' value='购买' disabled/>");
	print("</form>");
	print("</div>");
} elseif (get_user_class() == UC_VETERAN_USER) {
	print("<div>");
	print("<h1>升级到" . get_user_class_name_zh(UC_EXTREME_USER) . "</h1>");
	print("<table style='width: 95%'>");
	print("<tr class=rowfollow><td class='colhead' align='left'>项目</td><td class='colhead' align='left'>需求</td><td class='colhead' align='left'>条件</td><td class='colhead' align='left'>达成</td></tr>");
	print("<tr class=torrent_table><td>上传量</td><td>需要 " . mksize($ACCOUNT['exudl'] * 1073741824) . "</td><td>你有 " . mksize($CURUSER['uploaded']) . "</td><td>" . ($CURUSER['uploaded'] >= $ACCOUNT['exudl'] * 1073741824 ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>完成数</td><td>需要完成下载 " . $ACCOUNT['exuprratio'] . " 个</td><td>你完成了 $count 个下载</td><td>" . ($count >= $ACCOUNT['exuprratio'] ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>魔力值</td><td>需要 " . number_format($ACCOUNT['exuderatio']) . " 个魔力值</td><td>你有 " . number_format($CURUSER['seedbonus']) . " 个魔力值</td><td>" . ($CURUSER['seedbonus'] >= $ACCOUNT['exuderatio'] ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>加入时间</td><td>需要注册满 " . $ACCOUNT['exutime'] * 7 . " 天</td><td>你已经注册满 " . round((strtotime(date("Y-m-d H:i:s", time())) - strtotime($CURUSER['added'])) / 86400) . " 天</td><td>" . (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['exutime'] * 86400 * 7)) ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>H&R</td><td>需要 0 个H&R</td><td>你有 " . $CURUSER['hr'] . " 个H&R</td><td>" . ($CURUSER['hr'] <= 0 ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("</table><br />");
	print("<form method='POST'>");
	print((($CURUSER['uploaded'] >= $ACCOUNT['exudl'] * 1073741824) && ($count >= $ACCOUNT['exuprratio']) && ($CURUSER['seedbonus'] >= $ACCOUNT['exuderatio']) && (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['exutime'] * 86400 * 7))) && ($CURUSER['hr'] <= 0)) ? "<input type='submit' name='submit" . UC_VETERAN_USER . "' value='购买' />" : "<input type='submit' name='submit" . UC_VETERAN_USER . "' value='购买' disabled/>");
	print("</form>");
	print("</div>");
} elseif (get_user_class() == UC_EXTREME_USER) {
	print("<div>");
	print("<h1>升级到" . get_user_class_name_zh(UC_ULTIMATE_USER) . "</h1>");
	print("<table style='width: 95%'>");
	print("<tr class=rowfollow><td class='colhead' align='left'>项目</td><td class='colhead' align='left'>需求</td><td class='colhead' align='left'>条件</td><td class='colhead' align='left'>达成</td></tr>");
	print("<tr class=torrent_table><td>上传量</td><td>需要 " . mksize($ACCOUNT['uudl'] * 1073741824) . "</td><td>你有 " . mksize($CURUSER['uploaded']) . "</td><td>" . ($CURUSER['uploaded'] >= $ACCOUNT['uudl'] * 1073741824 ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>完成数</td><td>需要完成下载 " . $ACCOUNT['uuprratio'] . " 个</td><td>你完成了 $count 个下载</td><td>" . ($count >= $ACCOUNT['uuprratio'] ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>魔力值</td><td>需要 " . number_format($ACCOUNT['uuderatio']) . " 个魔力值</td><td>你有 " . number_format($CURUSER['seedbonus']) . " 个魔力值</td><td>" . ($CURUSER['seedbonus'] >= $ACCOUNT['uuderatio'] ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>加入时间</td><td>需要注册满 " . $ACCOUNT['uutime'] * 7 . " 天</td><td>你已经注册满 " . round((strtotime(date("Y-m-d H:i:s", time())) - strtotime($CURUSER['added'])) / 86400) . " 天</td><td>" . (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['uutime'] * 86400 * 7)) ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>H&R</td><td>需要 0 个H&R</td><td>你有 " . $CURUSER['hr'] . " 个H&R</td><td>" . ($CURUSER['hr'] <= 0 ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("</table><br />");
	print("<form method='POST'>");
	print((($CURUSER['uploaded'] >= $ACCOUNT['uudl'] * 1073741824) && ($count >= $ACCOUNT['uuprratio']) && ($CURUSER['seedbonus'] >= $ACCOUNT['uuderatio']) && (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['uutime'] * 86400 * 7))) && ($CURUSER['hr'] <= 0)) ? "<input type='submit' name='submit" . UC_EXTREME_USER . "' value='购买' />" : "<input type='submit' name='submit" . UC_EXTREME_USER . "' value='购买' disabled/>");
	print("</form>");
	print("</div>");
} elseif (get_user_class() == UC_ULTIMATE_USER) {
	print("<div>");
	print("<h1>升级到" . get_user_class_name_zh(UC_NEXUS_MASTER) . "</h1>");
	print("<table style='width: 95%'>");
	print("<tr class=rowfollow><td class='colhead' align='left'>项目</td><td class='colhead' align='left'>需求</td><td class='colhead' align='left'>条件</td><td class='colhead' align='left'>达成</td></tr>");
	print("<tr class=torrent_table><td>上传量</td><td>需要 " . mksize($ACCOUNT['nmdl'] * 1073741824) . "</td><td>你有 " . mksize($CURUSER['uploaded']) . "</td><td>" . ($CURUSER['uploaded'] >= $ACCOUNT['nmdl'] * 1073741824 ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>完成数</td><td>需要完成下载 " . $ACCOUNT['nmprratio'] . " 个</td><td>你完成了 $count 个下载</td><td>" . ($count >= $ACCOUNT['nmprratio'] ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>魔力值</td><td>需要 " . number_format($ACCOUNT['nmderatio']) . " 个魔力值</td><td>你有 " . number_format($CURUSER['seedbonus']) . " 个魔力值</td><td>" . ($CURUSER['seedbonus'] >= $ACCOUNT['nmderatio'] ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>加入时间</td><td>需要注册满 " . $ACCOUNT['nmtime'] * 7 . " 天</td><td>你已经注册满 " . round((strtotime(date("Y-m-d H:i:s", time())) - strtotime($CURUSER['added'])) / 86400) . " 天</td><td>" . (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['nmtime'] * 86400 * 7)) ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("<tr class=torrent_table><td>H&R</td><td>需要 0 个H&R</td><td>你有 " . $CURUSER['hr'] . " 个H&R</td><td>" . ($CURUSER['hr'] <= 0 ? "<font color=green>是</font>" : "<font color=red>否</font>") . "</td></tr>");
	print("</table><br />");
	print("<form method='POST'>");
	print((($CURUSER['uploaded'] >= $ACCOUNT['nmdl'] * 1073741824) && ($count >= $ACCOUNT['nmprratio']) && ($CURUSER['seedbonus'] >= $ACCOUNT['nmderatio']) && (strtotime($CURUSER['added']) <= strtotime(date("Y-m-d H:i:s", time() - $ACCOUNT['nmtime'] * 86400 * 7))) && ($CURUSER['hr'] <= 0)) ? "<input type='submit' name='submit" . UC_ULTIMATE_USER . "' value='购买' />" : "<input type='submit' name='submit" . UC_ULTIMATE_USER . "' value='购买' disabled/>");
	print("</form>");
	print("</div>");
} elseif (get_user_class() == UC_PEASANT) {
	stdmsg("抱歉", "你被打入冷宫，无权升级");
	stdfoot();
	exit;
} else {
	stdmsg("恭喜", "你已经达到最高等级啦！");
	stdfoot();
	exit;
}
